/*
   Copyright (c) 2019 Shanghai Xuanzi Technology Co. Ltd https://xuanzi.ltd
   XZMindMap is licensed under the Mulan PSL v1.
   You can use this software according to the terms and conditions of the Mulan PSL v1.
   You may obtain a copy of Mulan PSL v1 at:
      http://license.coscl.org.cn/MulanPSL
   THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
   PURPOSE.
   See the Mulan PSL v1 for more details.

*/

package xuanzi.openmind.lines;

import xuanzi.commons.graphics.Canvas;
import xuanzi.commons.graphics.Paint;
import xuanzi.commons.graphics.Path;
import xuanzi.commons.graphics.PointF;
import xuanzi.openmind.nodes.Node;
import xuanzi.openmind.renders.RenderBuffer;

public class AccedLine extends Line{
	
	float radius = 5;

	public void draw(Canvas canvas,Node node,Node item) {
		RenderBuffer parent = node.renderBuffer;
		RenderBuffer no = item.renderBuffer;
		PointF front = no.frontPoint;
		PointF end = parent.backPoint;
		float sign = front.y-end.y>0?radius:-radius;
		paint.stroke(item.renderBuffer.lineColor,item.renderBuffer.lineSize);
		path.reset();
		path.moveTo(end.x,end.y);
		path.cubicTo(front.x, end.y , end.x, front.y, front.x, front.y);
		
		//path.lineTo(end.x, front.y-sign);
		//path.lineTo(front.x, front.y);
		canvas.drawPath(path, paint); 
	}
	
	Paint paint = new Paint();

	Path path = new Path();
}
